/* eslint-disable prettier/prettier */
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { GirlModule } from './girl/girl.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserController } from './user/user.controller';
import { UserModule } from './user/user.module';
import { StudentController } from './student/student.controller';

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'localhost',
      port: 3306,
      database: 'test-user',
      username: 'root',
      password: '123456',
      retryDelay: 500, //重试连接数据库的间隔毫秒
      retryAttempts: 10, //重试的次数
      synchronize: true, //同步
      autoLoadEntities: true,
    }),
    GirlModule,
    UserModule,
  ],
  controllers: [AppController, UserController, StudentController],
  providers: [AppService],
})
/*
  AppModule
  1.只要被 providers 所修饰，@Injectable() 装配注解所修饰
  2.写一个service 被其他地方调用，@Injectable()
  3.才可以被放到 providers 放的类型、接口，都是被 @Injectable() 修饰
*/
export class AppModule {}
